package com.ruoyi.web.admin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.admin.domain.TdmFangShengTiaoJian;
import com.ruoyi.web.admin.service.ITdmFangShengTiaoJianService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 仿生条件Controller
 * 
 * @author ly
 * @date 2022-03-11
 */
@RestController
@RequestMapping("/admin/TdmFangShengTiaoJian")
public class TdmFangShengTiaoJianController extends BaseController
{
    @Autowired
    private ITdmFangShengTiaoJianService tdmFangShengTiaoJianService;

    /**
     * 查询仿生条件列表
     */
//    @PreAuthorize("@ss.hasPermi('admin:TdmFangShengTiaoJian:list')")
    @GetMapping("/list")
    public TableDataInfo list(TdmFangShengTiaoJian tdmFangShengTiaoJian)
    {
        startPage();
        List<TdmFangShengTiaoJian> list = tdmFangShengTiaoJianService.selectTdmFangShengTiaoJianList(tdmFangShengTiaoJian);
        return getDataTable(list);
    }

    /**
     * 导出仿生条件列表
     */
//    @PreAuthorize("@ss.hasPermi('admin:TdmFangShengTiaoJian:export')")
    @Log(title = "仿生条件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TdmFangShengTiaoJian tdmFangShengTiaoJian)
    {
        List<TdmFangShengTiaoJian> list = tdmFangShengTiaoJianService.selectTdmFangShengTiaoJianList(tdmFangShengTiaoJian);
        ExcelUtil<TdmFangShengTiaoJian> util = new ExcelUtil<TdmFangShengTiaoJian>(TdmFangShengTiaoJian.class);
        util.exportExcel(response, list, "仿生条件数据");
    }

    /**
     * 获取仿生条件详细信息
     */
//    @PreAuthorize("@ss.hasPermi('admin:TdmFangShengTiaoJian:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tdmFangShengTiaoJianService.selectTdmFangShengTiaoJianById(id));
    }

    /**
     * 新增仿生条件
     */
//    @PreAuthorize("@ss.hasPermi('admin:TdmFangShengTiaoJian:add')")
    @Log(title = "仿生条件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TdmFangShengTiaoJian tdmFangShengTiaoJian)
    {
        return toAjax(tdmFangShengTiaoJianService.insertTdmFangShengTiaoJian(tdmFangShengTiaoJian));
    }

    /**
     * 修改仿生条件
     */
//    @PreAuthorize("@ss.hasPermi('admin:TdmFangShengTiaoJian:edit')")
    @Log(title = "仿生条件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TdmFangShengTiaoJian tdmFangShengTiaoJian)
    {
        return toAjax(tdmFangShengTiaoJianService.updateTdmFangShengTiaoJian(tdmFangShengTiaoJian));
    }

    /**
     * 删除仿生条件
     */
//    @PreAuthorize("@ss.hasPermi('admin:TdmFangShengTiaoJian:remove')")
    @Log(title = "仿生条件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tdmFangShengTiaoJianService.deleteTdmFangShengTiaoJianByIds(ids));
    }
}
